<template>
	<view class="Processdetails">
		<u-parse :html="info" />
		<view class="specification" v-if='article_list && article_list.length > 0'>
			<view class="specification_title">
				编制参考标准及规范： 
			</view>
			<view class="specification_text" v-for='(row,i) in article_list' :key='i'>
				<text >{{row.name_top}}</text>
				<text @click="onImg(row.url)">{{row.name}}</text>
			</view>
		</view>
		<operation :info='objInfo' type='11' v-if='objInfo'></operation>
		<!-- <masks ref="masks"></masks> -->
		<foot></foot>
		<!-- <u-popup v-model="standard.visible" mode='center' closeable>
			<view class="popup">
					<swiper
						:current="current"
						class="content_box"
					>
						<swiper-item class="content_row" v-for="(item,index) in standard.list" :key='index'>
							<image :src="item" mode="scaleToFill"></image>
						</swiper-item>
					</swiper>
			</view>
		</u-popup> -->
	</view>
</template>

<script>
	import {setAddLook,setAddShare} from "@/utils/postRequest.js"
	import uPopup from '@/components/u-popup.vue'
	import {getStandardInfo} from './static/api.js'
	import operation from '@/pagesHome/operation.vue'
	// import masks from './mask.vue'
	import foot from '@/components/foot.vue'
	export default {
		components:{
			operation,
			// masks,
			uPopup,
			foot
		},
		data() {
			return {
				id:null,
				type:2,
				status:2,
				article_list:[],
				info:'',
				objInfo:null,
			}
		},
		async onShareAppMessage(res) {
		  await  setAddShare({id:this.id,type:11,isErr:false})
		   this.objInfo.transmit ++ 
		  return {
			title: this.objInfo.title,
			imageUrl: this.$global.shareImg,
			path: `/pagesHome/Processdetails?id=${this.id}&invitation_code=${this.$store.state.userInfo ? this.$store.state.userInfo.invitation_code : ''}`,
		  };
		},
		async onShareTimeline(ops) {
		  await  setAddShare({id:this.id,type:11,isErr:false})
		   this.objInfo.transmit ++ 
		  return {
			title: this.objInfo.title,
			imageUrl: this.$global.shareImg,
			path: `/pagesHome/Processdetails?id=${this.id}&invitation_code=${this.$store.state.userInfo ? this.$store.state.userInfo.invitation_code : ''}`,
		  };
		},
		onLoad(prams) {
			this.id = prams.id
			if(prams.type) this.type = prams.type;
			this.getInfo()
		},
		methods: {
			onImg(list){
				uni.previewImage({
					urls: list,
				});
			},
			// popUp(){
			// 	this.$refs.masks.show = true
			// },
			//查询当前商品
			async getInfo(){
				uni.showLoading()
				try{
					var res = await getStandardInfo({id:this.id,status:this.status})
					console.log(res,'查询新闻详情')
					if(res.data.status != 4){
						this.objInfo = res.data
						this.info = res.data.content
						this.article_list = res.data.article_list
						if(res.data.title){
							uni.setNavigationBarTitle({
							  title: res.data.title 
							})
						}
						setAddLook({id:id,type:11,isErr:false})
						this.$global.$editUploadBack(1,`workmanshipLook?id=${id}`)
					}else{
						uni.showToast({title:'文章已删除',duration: 2000})
						setTimeout(()=>{
							uni.navigateBack()
						},1500)
					}
					
					
					uni.hideLoading()
				}catch{
					uni.hideLoading()
				}
			},
			// getStandardInfo(id){
			// 	getStandardInfo({id:this.id,status:this.status}).then(res=>{
			// 		this.objInfo = res
			// 		this.info = res.content
			// 		this.article_list = res.article_list
			// 		if(res.title){
			// 			uni.setNavigationBarTitle({
			// 			  title: res.title 
			// 			})
			// 		}
			// 		setAddLook({id:id,type:11,isErr:false})
			// 		this.$global.$editUploadBack(1,`workmanshipLook?id=${id}`)
			// 	})
			// }
		},
	}
</script>

<style scoped lang="scss">
	@import url("./Processdetails.css");
	.popup{
		// width: 750rpx;
		// padding: 88rpx 36rpx;
		// height: 100vh;
		// box-sizing: border-box;
		.content_box{
			padding: 88rpx 0;
			box-sizing: border-box;
			width:750rpx;
			height: 80vh;
			// background-color: red;
			.content_row{
				width: 100%;
				height: 100%;
				padding: 0 36rpx;
				box-sizing: border-box;
			}
			.content_row{
				width: 100%;
				height: 100%;
				image{
					width: 100%;
					height: 100%;
				}
			}
		}
	}
</style>
